import 'babel-polyfill'
import Vue from 'vue'
// JavaScript 函数库、工具类 https://x-extends.gitee.io/xe-utils/#/
import XEUtils from 'xe-utils'
// 123

Vue.config.devtools = true
import 'normalize.css/normalize.css'// A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// collapse 展开折叠
import CollapseTransition from 'element-ui/lib/transitions/collapse-transition'
import locale from 'element-ui/lib/locale/lang/zh-CN'

import '@/styles/index.scss' // global css
import '@/styles/newstyle.scss'
import '@/styles/styleVersion.scss'
import '@/styles/pageBtn.css'
import '@/styles/publicStyle.css'
import App from './App'
import router from './router'
import store from './store'
import './utils/theme'
import '@/styles/changeStyle.scss'
import '@/icons' // icon
import '@/permission' //  permission control
// import '@/isToken'
import 'video.js/dist/video-js.css'
import 'vue-video-player/src/custom-theme.css'
import './assets/iconfont.css'
import '@/styles/changeTheme/temChangeStyle.scss'
import '@/styles/changeTheme/privateStyle.scss'
import '@/styles/modelStyle/apiManage.scss'

import VueI18n from 'vue-i18n'
import Cookies from 'js-cookie'
import JSEncrypt from 'jsencrypt'

import VXETable from 'vxe-table'
import 'vxe-table/lib/index.css'
Vue.use(VXETable)

import TreeTable from 'vue-table-with-tree-grid'

Vue.component('tree-table', TreeTable)

import echarts from 'echarts'
Vue.prototype.$echarts = echarts;

import vuedraggable from 'vuedraggable'
Vue.component('vuedraggable', vuedraggable)

sessionStorage.setItem('refreshSelectedTag', 'true')
Vue.use(ElementUI, { locale })

Vue.component(CollapseTransition.name, CollapseTransition)

Vue.prototype.$getRsaCode = function (str) { // 注册方法
  let pubKey = `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKHzdvHwQggv6GGXegnVYk+ifKBQwQiMlqL/NhfHaUMaydObUPIG3hkP1Y0S79vKyUZaSucg8H87fpvp8hHIwwEAnebIKkxGbRZRGwE7tEp2mtfb62pEK2ke6E/RjGRvMdrbwz7Z+aPhVtt/4g0uYQAoRoK8NxFgh0dGz7LvoZewIDAQAB` // ES6 模板字符串 引用 rsa 公钥
  let encryptStr = new JSEncrypt()
  encryptStr.setPublicKey(pubKey) // 设置 加密公钥
  const myData = encryptStr.encrypt(str.toString()) // 进行加密
  return myData
}
// 将 XEUtils 组件挂载到 Vue 原型对象中(调用方法 this.$utils.isNumber(11) )
Vue.prototype.$utils = XEUtils
Vue.prototype.$cookie = XEUtils.cookie

Vue.config.productionTip = false
import VueResource from 'vue-resource'
Vue.use(VueResource)
Vue.use(VueI18n)

const i18n = new VueI18n({
  locale: Cookies.get('language') || 'zh-CN', // 语言标识
  messages: {
    'zh-CN': require('./language/zh_CH'), // 中文语言包
    'en-US': require('./language/en') // 英文语言包
  }
})

// Mock
// import "@/mockServer/mock_ComprehensiveQueryTable.js"

new Vue({
  el: '#app',
  router,
  i18n,
  store,
  template: '<App/>',
  components: { App }
})

